%\usepackage{kpfonts}



% AU Press page size 6x9in with 56pt margins top, left, right
%    94.08pt margin bottom
\setlength{\paperwidth}{6in}
\setlength{\paperheight}{9in}
% Left and right margins
\setlength{\hoffset}{-1in}
\setlength{\oddsidemargin}{0in}
\addtolength{\oddsidemargin}{56pt}
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-112pt}
\setlength{\evensidemargin}{\oddsidemargin}
% Top and bottom margins
\setlength{\voffset}{-1in}
\setlength{\topmargin}{-0in}
\addtolength{\topmargin}{56pt}
\setlength{\headheight}{12pt}
\setlength{\headsep}{14pt}
\addtolength{\topmargin}{-\headsep}
\addtolength{\topmargin}{-\headheight}
\setlength{\textheight}{\paperheight} 
\addtolength{\textheight}{-94.08pt}
\addtolength{\textheight}{-\topmargin}
\addtolength{\textheight}{-\headheight}
\addtolength{\textheight}{-\headsep}
%\setlength{\footheight}{12pt}
\setlength{\footskip}{28pt}
\addtolength{\footskip}{14pt}



%\usepackage[total={6in,9in},top=56pt, left=56pt, includefoot]{geometry}
%\flushbottom


%\renewcommand{\baselinestretch}{1.4}

%\usepackage{setspace}
%\spacing{1.4}


%% Normal (non AU Press) formatting
% Page setup
%\setlength{\textheight}{8.5in}
%\setlength{\textwidth}{6in}
%\setlength{\topmargin}{-0.375in}
%\setlength{\oddsidemargin}{.25in}
%\setlength{\evensidemargin}{.25in}
%\setlength{\headheight}{0.200in}
%\setlength{\headsep}{0.4in}
%\setlength{\footskip}{0.500in}
%\setlength{\parskip}{0.5ex}
%\setlength{\parindent}{1.25cm}
%\renewcommand{\baselinestretch}{1.3}
%\flushbottom

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead{}   % clear all headers
\fancyfoot{}   % clear all footers
\fancyfoot[CE,CO]{\small\thepage}
% left mark holds the chapter title
\renewcommand{\chaptermark}[1]{\markboth{#1}{\textsection\thechapter+#1}} 
\renewcommand{\sectionmark}[1]{\markright{\textsection\thesection+#1}} 
\fancyhead[CE]{\small\nouppercase{\leftmark}} % chapter title, left center
%\fancyhead[CO]{\small\nouppercase{\rightmark}} % section title, right center






%% In our headers, we pack both the section number and the section title
%% into the \rightmark.  These are then extracted using \rightmarksection
%% and \rightmarktitle
%% This code comes from Heiko Oberdiek and David Carlisle
%% See http://tex.stackexchange.com/questions/121452/separate-section-number-in-headers
%% for more details
\makeatletter
\newcommand*{\rightmarksection}{%
  \begingroup
    \protected@edef\temp{\rightmark}%
    \expandafter\@rightmarksection\temp. \@nil
  \endgroup
}
\def\@rightmarksection#1+#2\@nil{%
  \def\temp{#2}%
  \ifx\temp\@empty
  \else
    #1%
  \fi  
}
\makeatother

\makeatletter
\newcommand*{\rightmarktitle}{%
  \begingroup
    \protected@edef\temp{\rightmark}%
    \expandafter\@rightmarktitle\temp \@nil
  \endgroup
}
\def\@rightmarktitle#1+#2\@nil{%
  \def\temp{#2}%
  \ifx\temp\@empty
  \else
    #2%
  \fi  
}
\makeatother
\fancypagestyle{plain}{% for the first page of chapters
  \renewcommand{\headrulewidth}{0pt}%
  \fancyhf{}%
  \fancyfoot[C]{\small\thepage}%
}


% small fonts for captions
\usepackage[font=small]{caption}

%\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
%\renewcommand{\chaptermark}[1]{% 
%  \markboth{\thechapter.\ #1}{}} 
%\renewcommand{\headrulewidth}{0pt}
%%\renewcommand{\footrulewidth}{0.4pt}
%%\lhead{\itshape\nouppercase{\leftmark}}
%\rhead{\small\itshape\thepage}%\itshape\nouppercase{\leftmark}}
%%\lhead[E]{\itshape\nouppercase{\leftmark}}
%
%\lhead[\small\itshape\nouppercase{\leftmark}]{\small\itshape\nouppercase{\rightmark}}
%\fancyfoot[C]{} %\small\thepage}



% Title block fonts
\font\tensfb = cmssbx11
\font\titlefont = cmssbx28
\font\authorfont = cmssbx17

%\def\title#1{\gdef\@title{#1}\gdef\THETITLE{#1}}

%\renewcommand\maketitle{%
%  \newlength{\lone}
%  \newlength{\ltwo}
%  \newlength{\lthree}
%  \setlength{\lone}{0.3\textheight}
%  \setlength{\ltwo}{0.618033988\lone}
%  \setlength{\lthree}{0.618033988\ltwo}
%  \begin{flushleft}
%    \ \\[.5in]
%    \includegraphics[width=\ScaleIfNeeded]{images/tree3-thick}\\
%    \ \\[.5in]
%    {\hspace{-1mm}\fontsize{28}{1}\usefont{OT1}{jkpss}{b}{n}\thetitle} \\[1ex]
%    {\fontsize{17}{1}\usefont{OT1}{jkpss}{b}{n}\theauthor} \\[\ltwo]
%    {\fontsize{11}{1}\usefont{OT1}{jkpss}{b}{n}\thedate} \\[\lthree]
%    \includegraphics[scale=0.5]{images/cc-by}
%  \end{flushleft}
%}

\renewcommand{\eqref}[1]{(\ref{eq:#1})}

\long\def\symbolfootnote[#1]#2{\begingroup%
\def\thefootnote{\fnsymbol{footnote}}\footnote[#1]{#2}\endgroup}

% We can do this since latex2html doesn't read this file
\newcommand{\htmlonly}[1]{}

%% This code allows dynamic scaling of images to fit the page
%% Usage: \includegraphics[width=\ScaleIfNeeded]{figs/figure}
\makeatletter
\def\ScaleIfNeeded{%
\ifdim\Gin@nat@width>.97\linewidth
.97\linewidth
\else
\Gin@nat@width
\fi
}
\makeatother

\makeatletter
\def\HalfScaleIfNeeded{%
\ifdim\Gin@nat@width>.46\linewidth
.46\linewidth
\else
\Gin@nat@width
\fi
}
\makeatother

\makeatletter
\def\HeightScaleIfNeeded{%
\ifdim\Gin@nat@height>.8\textheight
.8\textheight
\else
\Gin@nat@height
\fi
}
\makeatother


\makeatletter
\def\QuarterHeightScaleIfNeeded{%
\ifdim\Gin@nat@height>.22\textheight
.22\textheight
\else
\Gin@nat@height
\fi
}
\makeatother

\makeatletter
\def\FifthHeightScaleIfNeeded{%
\ifdim\Gin@nat@height>.168\textheight
.168\textheight
\else
\Gin@nat@height
\fi
}
\makeatother

\newcommand{\thetitlepage}{
  \begin{titlepage}
    \newlength{\lone}
    \newlength{\ltwo}
    \newlength{\lthree}
    \setlength{\lone}{0.3\textheight}
    \setlength{\ltwo}{0.618033988\lone}
    \setlength{\lthree}{0.618033988\ltwo}
    \begin{flushleft}
      \ \\[.1\paperheight]
      \includegraphics[width=\linewidth]{images/tree3-thick}\\
      {\fontsize{21}{1}\usefont{OT1}{jkpss}{b}{n}%
       \resizebox{\linewidth}{!}{\thetitle}} \\[\lthree]
      {\fontsize{14}{1}\usefont{OT1}{jkpss}{b}{n}\thedate} \\[\lthree]
      {\fontsize{11}{1}\usefont{OT1}{jkpss}{b}{n}\theauthor} \\[\lthree]
      \includegraphics[scale=0.5]{images/cc-by}
    \end{flushleft}
  \end{titlepage}
}


